<?php

class news_handler extends _site_handler {
	public $NewsAddLink;
	public $Pagination;

	public $PageNumber = 1;
	public $PostsPerPage = 10;
	public $Posts;

	public function __construct($m, $view) {
		$this->InitializeSite($m);
		if ( isset($_GET['page']) && intval($_GET['page']) ) $this->PageNumber = intval($_GET['page']);
		$this->Wordlets->AddWordlets('news');

		$blog = new Blog(1);

		$this->Posts = $blog->Posts(($this->PageNumber - 1) * $this->PostsPerPage, $this->PostsPerPage);

		$this->RenderViewContent($view);
	}
}
